import { QiankunApp } from '@lhy-assist/qiankun'
import { PlatformFrameAction, PlatformFrameState } from 'qiankun-frame'
import store from '@/store'
import * as mutationTypes from '@/store/mutation-type'

// qiankun-frame更改为对应的主应用，主应用需导出state和action供子应用引用以保证数据结构一致性
export const qiankunApp = new QiankunApp<PlatformFrameState, PlatformFrameAction>()

qiankunApp.onStateChange(data => {
  console.log('app-vue2 stateChange', data)
  store.commit(mutationTypes.SET_FRAME_STATE, data)
})
